<?php

namespace app\api\controller;
use think\facade\Db;
/**
 * 页面控制器
 */
class Home extends Controller
{
    public function carmsg()
    {
        $where = array('status' => 0);
        $data = array(
            'todayorder'     => 0,
            'monthorder'     => 0,
            'trimesterorder' => 0,
            'unitCar'        => 0,
            'travelCar'      => 0,
            'personCar'      => 0,
            'peer'           => 0,
            'unitid_id'      => 0,
            'travel_id'      => 0,
            'person_id'      => 0,
            'peer_id'        => 0,
            'slideshow'      => array()
        );
        $stime = date('Y-m-d H:i:s',time());
        $et    = time()+3600*24*30;
        $etime = date('Y-m-d H:i:s',$et);
        $carorder = Db::name('car_order')->where($where)->whereBetween('star_time',$stime.",".$etime)->select();
        foreach ($carorder as $v) {
            if ($v['star_time'] < date('Y-m-d 23:59:59',time())) {
                $data['todayorder']++;
            }
            if ($v['star_time'] < date('Y-m-d 23:59:59',time()+3*3600*24)) {
                $data['monthorder']++;
            }
            if ($v['star_time'] < date('Y-m-d 23:59:59',time()+30*3600*24)) {
                $data['trimesterorder']++;
            }
        }
        return $this->renderSuccess('', $data);
    }
    public function getcartype()
    {
        $type = Db::name('car_type')->select();
        return $this->renderSuccess('', ["car_type" => $type]);
    }
    public function getdrivertype()
    {
        $type = Db::name('driver_type')->select();
        return $this->renderSuccess('', ["driver_type" => $type]);
    }
    public function msgContent()
    {
        return $this->renderSuccess('', [
            'abus' => '关于我们关于我们关于我们关于我们关于我们关于我们',
            'help' => '帮助中心帮助中心帮助中心帮助中心帮助中心帮助中心'
        ]);
    }
    public function get_address()
    {
        return $this->renderSuccess('', [
            'addresslist' => []
        ]);
    }
    public function bank_type()
    {
        $list = Db::name('user_bank_type')->select();
        return $this->renderSuccess('', [
            'type_list' => $list
        ]);
    }
    public function get_msg()
    {
        return $this->renderSuccess('', [
            'msg_list' => '联合拉上线啦！'
        ]);
    }
}
